package com.asura.ops.sync.api;

import com.asura.base.response.FeignResponseBase;
import com.asura.ops.sync.api.model.CfgClientDto;
import com.asura.ops.sync.api.model.ErrorReportDto;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import static com.asura.ops.sync.api.constant.FeignConstant.FEIGN_API_BASE_PATH;

/**
 * @author: zouyang
 * @date: 2022/8/1
 * @description: 同步服务配置接口API
 */
@FeignClient(contextId = "SyncCfgApi", value = "${asura.sync.feign.server:asura-ops-sync-server}", path = FEIGN_API_BASE_PATH)
@RequestMapping(value = "/feign/sync")
public interface SyncApi {

    /**
     * 根据客户端code获取客户端同步配置
     *
     * @param clientCode 客户端code
     * @return 客户端同步配置集合
     */
    @GetMapping("/getCfgClient")
    FeignResponseBase<CfgClientDto> getCfgClient(@RequestParam(value = "clientCode") String clientCode);

    /**
     * 客户端消息处理失败上报
     *
     * @param errorReport
     * @return
     */
    @PostMapping("/errorReport")
    FeignResponseBase<CfgClientDto> errorReport(@RequestBody ErrorReportDto errorReport);

}
